import json


def read_json(filename):
    filepath = "../data/" + filename
    # 获取文件流 并调用load
    with open(filepath, "r", encoding="utf-8") as f:
        return json.load(f)


"""
    问题：
        需求格式：[(),()]或[[],[]]
    解决：
        1.新建空列表arrs=[]
        2.读取现有的json值，存放到列表中
"""

if __name__ == '__main__':
    print(read_json("login.json"))
    print("--" * 60)
    # 新建空列表
    arrs1 = []
    for data1 in read_json("login.json").values():
        # print(data)
        arrs1.append((data1.get("username"),
                    data1.get("password"),
                    data1.get("verify_code"),
                    data1.get("expect")))
    print(arrs1)#[(),()]
    arrs2=[]
    for data2 in read_json("login.json").values():
        arrs2.append([data2.get("username"),
                      data2.get("password"),
                      data2.get("verify_code"),
                      data2.get("expect")])
    print(arrs2)#[[],[]]
